home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / radix50 < prev    next >
Text File  |  1995-03-31  |  2KB  |  60 lines

  1.  
  2. This program is for the HP48SX.
  3. For those of you who are still working with old DEC hardware, here are a
  4. couple of programs that may be useful. They convert 3-character strings to/
  5. from Radix-50 numbers. Radix-50 is/(was?) used to store 3 characters in one
  6. 16-bit word on PDP11's and is used for directory entries and task names under
  7. RSX11, RT11 etc.
  8. The program R50\-> converts a radix50 word (as a binary object) to a 3
  9. character string, and the program \->R50 converts a string (up to 3 characters
  10. long) to the coresponding radix50 word.
  11. The word size must be set to >16 bits when using these programs, and you will
  12. probably find it useful to set the base to octal.
  13. I may write some more DEC-hacking programs, as I am still running a PDP11/45.
  14. If anybody is interested, or has writen any such programs, please e-mail me.
  15.  
  16. Tony Duell.
  17. e-mail : Janet ARD@UK.AC.BRIS.SIVA
  18.         Bitnet ARD@SIVA.BRIS.AC.UK
  19.  
  20. ------------------>8-------------------->8-------------------->8-------------
  21.  
  22. %%HP: T(3)A(R)F(.);
  23. DIR
  24.   \->R50
  25.     \<< "   " SWAP +
  26. DUP SIZE DUP 2 -
  27. SWAP SUB 0 1 3
  28.       FOR n 40 *
  29. OVER n DUP SUB
  30. " ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789"
  31. SWAP POS 1 -
  32.         IF DUP 0 <
  33.         THEN
  34. "Invalid String"
  35. DOERR
  36.         END +
  37.       NEXT SWAP
  38. DROP R\->B
  39.     \>>
  40.   R50\->
  41.     \<<
  42.       IF DUP
  43. # 174777o >
  44.       THEN
  45. "Invalid Radix 50"
  46. DOERR
  47.       END B\->R "" 1
  48. 3
  49.       START OVER 40
  50. MOD 1 +
  51. " ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789"
  52. SWAP DUP SUB SWAP +
  53. SWAP 40 / IP SWAP
  54.       NEXT SWAP
  55. DROP
  56.     \>>
  57. END
  58.  
  59.  
  60.